local hx__tiancongyun = fk.CreateSkill{
    name = "hx__tiancongyun",

    tags = {},
}

hx__tiancongyun:addEffect(fk.CardUsing,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(hx__tiancongyun.name) and target and target == player and data.card and data.card.type == Card.TypeEquip
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local to = room:askToChoosePlayers(player,{ min_num = 1, max_num = 1, targets = room:getOtherPlayers(player), skill_name = hx__tiancongyun.name, cancelable = true, prompt = "#hx__tiancongyun__evoke", })
        if #to > 0 then
            room:addTableMarkIfNeed(player,"hx__guangsuti__tars",to[1].id)
            event:setCostData(self,to[1])
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self)
        room:moveSeatTo(player,to:getLastAlive().seat,false)
        local targets = table.filter(room.alive_players,function (p)
            return table.contains(player:getTableMark("hx__guangsuti__tars"),p.id)
        end)
        if #targets > 0 then
            for _, v in ipairs(targets) do
                v:setChainState(true)
            end
            local tar = room:askToChoosePlayers(player,{ min_num = 1, max_num = 1, targets = targets, skill_name = hx__tiancongyun.name, cancelable = false, prompt = "#hx__tiancongyun__damage", })
            if #tar > 0 then
                room:damage{
                    to = tar[1],
                    damage = 1,
                    from = player,
                    skillName = hx__tiancongyun.name,
                }
            end
        end

    end,
})

return hx__tiancongyun